/*******************************************************************************
 * Copyright (c) 2000, 2010 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.gef.examples.shapes.actions;

import java.util.List;

import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.examples.shapes.model.Shape;
import org.eclipse.gef.examples.shapes.parts.TransSetEditPart;
import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.ui.IWorkbenchPart;

/**
 * @author Eric Bordeau
 */
public class RotateAction extends SelectionAction {

	public static final String ID = "shapes.actions.RotateAction";

	public RotateAction(IWorkbenchPart part) {
		super(part);
		setId(ID); // sets ID
		setText("Rotate selected shape");
		setToolTipText("Rotate");

	}

	@Override
	protected boolean calculateEnabled() {
		List<Object> objects = getSelectedObjects();

		if (objects.isEmpty()) {
			return false;
		}

		if (!(objects.get(0) instanceof TransSetEditPart)) {
			return false;
		}

		return true;
	}

	public void run() {
		List<Object> objects = getSelectedObjects();

		TransSetEditPart transSetEditPart = (TransSetEditPart) objects.get(0);

		System.err.println(transSetEditPart);


	}

}
